package com.itheima.day05.contact.service;

import java.util.List;
import java.util.UUID;

import com.itheima.day05.contact.dao.ContactRepository;
import com.itheima.day05.contact.pojo.Contact;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


public class ContactService {

    
    private ContactRepository contactRepository;

    public void saveContact(Contact contact) {
        contactRepository.save(contact);
    }

    public List<Contact> findAllContacts() {
        return contactRepository.findAll();
    }

    public Contact findContactById(Integer id) {
        return contactRepository.findById(id);
    }

    public void updateContact(Contact contact) {
        contactRepository.update(contact);
    }

    public void deleteContact(Integer id) {
        contactRepository.delete(id);
    }
}